package teste;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class ModificadorTxtVersao3 {
	
	private static String nomeArquivo;
	
	public static void modificaArquivo(int coluna, String modificacao) throws IOException {
		
		
		//teste
		BufferedReader bufferdReader = new BufferedReader(new FileReader(nomeArquivo));
		
		BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("foo.out"));
		
		 while((bufferdReader.readLine()) !=null) {          
	            System.out.println(bufferdReader.readLine());
	            bufferedWriter.write(bufferdReader.readLine());
	            
	     }  
		 
		 if (bufferedWriter != null) {
             bufferedWriter.flush();
             bufferedWriter.close();
         }
		 
		 bufferdReader.close();
	}
	
	public static void geraSaida(String arquivoFormatado) {

		try {
			FileWriter fstream = new FileWriter(nomeArquivo);
			BufferedWriter out = new BufferedWriter(fstream);
			out.write(arquivoFormatado);
			out.close();
		} catch (Exception e) {
			System.err.println("Erro: " + e.getMessage());
		}
	}
	
	public static void main(String[] args) {
		try {
			nomeArquivo = "teste.txt";
			modificaArquivo(439, "000000");
			//geraSaida(arquivoFormatado);
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
